/* 销售机会管理页面专用样式 */

/* ==================== 销售漏斗概览 ==================== */
.funnel-overview {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.funnel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.funnel-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
}

.funnel-controls .form-select {
    min-width: 120px;
}

.funnel-stages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.stage-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stage-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stage-card.stage-1 {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid #2196f3;
}

.stage-card.stage-2 {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    border-left: 4px solid #4caf50;
}

.stage-card.stage-3 {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-left: 4px solid #ff9800;
}

.stage-card.stage-4 {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
    border-left: 4px solid #e91e63;
}

.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stage-number {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.stage-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
}

.stage-stats {
    margin-bottom: 16px;
}

.stage-count {
    font-size: 28px;
    font-weight: 700;
    color: #1d1d1f;
    line-height: 1;
}

.stage-amount {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.stage-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007AFF 0%, #5AC8FA 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    min-width: 30px;
}

/* ==================== 搜索筛选区域 ==================== */
.search-filter-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-filter-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-box {
    position: relative;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8e8e93;
    font-size: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid #d1d1d6;
    border-radius: 8px;
    font-size: 14px;
    background: #f2f2f7;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #007AFF;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #8e8e93;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-input:not(:placeholder-shown) + .search-clear {
    opacity: 1;
}

.search-clear:hover {
    color: #ff3b30;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    font-size: 14px;
    background: #ffffff;
    color: #1d1d1f;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* ==================== 统计卡片 ==================== */
.stats-section {
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
}

.stat-icon.stat-primary {
    background: linear-gradient(135deg, #007AFF 0%, #5AC8FA 100%);
}

.stat-icon.stat-success {
    background: linear-gradient(135deg, #34c759 0%, #30d158 100%);
}

.stat-icon.stat-warning {
    background: linear-gradient(135deg, #ff9500 0%, #ffcc02 100%);
}

.stat-icon.stat-info {
    background: linear-gradient(135deg, #5856d6 0%, #af52de 100%);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #1d1d1f;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: #34c759;
}

.stat-change.negative {
    color: #ff3b30;
}

/* ==================== 表格样式 ==================== */
.table-section {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #f2f2f7;
}

.table-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0 0 4px 0;
}

.result-count {
    font-size: 14px;
    color: #666;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-toggle {
    display: flex;
    background: #f2f2f7;
    border-radius: 6px;
    padding: 2px;
}

.view-btn {
    padding: 6px 12px;
    border: none;
    background: none;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn.active {
    background: #ffffff;
    color: #007AFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-container {
    overflow-x: auto;
}

.opportunity-table {
    width: 100%;
    border-collapse: collapse;
}

.opportunity-table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e5ea;
    position: relative;
}

.opportunity-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.opportunity-table th.sortable:hover {
    background: #f0f0f5;
}

.opportunity-table th .fas {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.5;
}

.opportunity-table td {
    padding: 16px;
    border-bottom: 1px solid #f2f2f7;
    vertical-align: top;
}

.opportunity-row:hover {
    background: #fafbfc;
}

.opportunity-number {
    font-family: 'SF Mono', monospace;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.opportunity-info .name {
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.customer-link .link-text {
    font-size: 12px;
    color: #007AFF;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.customer-link .link-text:hover {
    text-decoration: underline;
}

.customer-details .customer-name {
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 2px;
}

.customer-details .customer-phone {
    font-size: 12px;
    color: #666;
}

.level-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    min-width: 36px;
    display: inline-block;
}

.level-badge.level-a {
    background: #ffe6e6;
    color: #d32f2f;
}

.level-badge.level-b {
    background: #fff3e0;
    color: #f57c00;
}

.level-badge.level-c {
    background: #e8f5e8;
    color: #388e3c;
}

.level-badge.level-d {
    background: #e3f2fd;
    color: #1976d2;
}

.stage-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stage-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    background: #f2f2f7;
    color: #666;
}

.stage-badge.stage-1 { background: #e3f2fd; color: #1976d2; }
.stage-badge.stage-2 { background: #e8f5e8; color: #388e3c; }
.stage-badge.stage-3 { background: #fff3e0; color: #f57c00; }
.stage-badge.stage-4 { background: #fce4ec; color: #c2185b; }
.stage-badge.stage-5 { background: #f3e5f5; color: #7b1fa2; }

.stage-progress-mini {
    height: 3px;
    background: #f2f2f7;
    border-radius: 2px;
    overflow: hidden;
}

.progress-line {
    height: 100%;
    background: linear-gradient(90deg, #007AFF 0%, #5AC8FA 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.amount {
    font-weight: 600;
    color: #1d1d1f;
    font-family: 'SF Mono', monospace;
}

.date {
    color: #666;
    font-size: 14px;
}

.consultant {
    color: #1d1d1f;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f2f2f7;
    color: #666;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #007AFF;
    color: #ffffff;
}

/* ==================== 看板视图 ==================== */
.kanban-container {
    padding: 20px;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    overflow-x: auto;
}

.kanban-column {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    min-height: 500px;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e5ea;
}

.column-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
}

.column-header .count {
    background: #007AFF;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kanban-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: all 0.3s ease;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.kanban-card .card-title {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 14px;
    margin-bottom: 4px;
}

.kanban-card .card-customer {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
}

.kanban-card .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
}

/* ==================== 模态框样式 ==================== */
.action-menu {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1001;
    min-width: 200px;
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 14px;
    color: #1d1d1f;
}

.action-menu-item:hover {
    background: #f2f2f7;
}

.action-menu-item.danger {
    color: #ff3b30;
}

.action-menu-item.cancel {
    border-top: 1px solid #f2f2f7;
    color: #666;
}

.advance-modal {
    max-width: 500px;
}

.stage-progress-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stage-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

.stage-circle.current {
    background: #007AFF;
}

.stage-circle.next {
    background: #34c759;
}

.stage-name {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    margin-top: 8px;
}

.stage-arrow {
    font-size: 24px;
    color: #666;
}

/* ==================== 分页样式 ==================== */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-top: 1px solid #f2f2f7;
    background: #fafbfc;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d1d1d6;
    background: #ffffff;
    color: #666;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.page-btn:hover:not(:disabled) {
    background: #f2f2f7;
}

.page-btn.active {
    background: #007AFF;
    color: #ffffff;
    border-color: #007AFF;
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-dots {
    padding: 0 8px;
    color: #666;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.page-size-selector select {
    padding: 4px 8px;
    border: 1px solid #d1d1d6;
    border-radius: 4px;
    font-size: 14px;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .funnel-stages {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .kanban-board {
        grid-template-columns: 1fr;
    }
    
    .pagination-container {
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .search-filter-container {
        padding: 16px;
    }
    
    .stage-card {
        padding: 16px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .opportunity-table th,
    .opportunity-table td {
        padding: 12px 8px;
        font-size: 12px;
    }
}